﻿// 1. Write a program to convert decimal numbers to their binary representation.

using System;

class DecimalToBinaryNumbers
{
    static void Main()
    {
        Console.Write("Enter your decimal number : ");
        string decimalNumberStr = Console.ReadLine();
        int decimalNumber = int.Parse(decimalNumberStr);

        string binaryNumber = "";
        binaryNumber = ConvertIntoBinary(decimalNumber);

        Console.WriteLine("The binary representation of the decimal number {0} is {1}.", decimalNumberStr, binaryNumber);
    }

    static string ConvertIntoBinary(int decimalNumber)
    {
        string binaryNumber = "";
        int remainder = 0;

        while (decimalNumber > 0)
        {
            remainder = decimalNumber % 2;
            decimalNumber /= 2;
            binaryNumber = remainder + binaryNumber;
        }

        return binaryNumber;
    }
}
